package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppIncomeStatement;
import com.ep.modules.app.service.AppIncomeStatementService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/income_statement")
public class AppIncomeStatementController {
    @Autowired
    private AppIncomeStatementService appIncomeStatementService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appIncomeStatementService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppIncomeStatement appincomestatement = appIncomeStatementService.getById(id);
        return R.ok().put("appincomestatement", appincomestatement);
    }

    @SysLog("保存AppIncomeStatement")
    @PostMapping("/save")
    public R save(@RequestBody AppIncomeStatement appincomestatement) {
        ValidatorUtils.validateEntity(appincomestatement);
        appIncomeStatementService.save(appincomestatement);
        return R.ok();
    }

    @SysLog("修改AppIncomeStatement")
    @PostMapping("/update")
    public R update(@RequestBody AppIncomeStatement appincomestatement) {
        ValidatorUtils.validateEntity(appincomestatement);
        appIncomeStatementService.update(appincomestatement);
        return R.ok();
    }

    @SysLog("删除AppIncomeStatement")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appIncomeStatementService.deleteBatch(ids);
        return R.ok();
    }
}